import { PageReq, PageRes } from '@/api/types'
import request from '@/utils/request'
import { WarehouseModel } from '@/api/model/sys/warehouse-model'

// 获取仓库列表
export function warehousePageApi(data: PageReq<Partial<WarehouseModel>>) {
  return request<PageRes<WarehouseModel>>({
    url: '/warehouse/page',
    method: 'post',
    data
  })
}

// 新增仓库
export function addWarehouseApi(data: Partial<WarehouseModel>) {
  return request({
    url: '/warehouse/add',
    method: 'post',
    data
  })
}

// 更新仓库
export function editWarehouseApi(
  data: Partial<WarehouseModel & { id: number }>
) {
  return request({
    url: '/warehouse/edit',
    method: 'post',
    data
  })
}

// 删除仓库
export function delWarehouseApi(data: { id: number }) {
  return request({
    url: '/warehouse/del',
    method: 'post',
    data
  })
}

// 获取仓库列表
export function getWarehouseListApi() {
  return request({
    url: '/warehouse/getWarehouseList',
    method: 'post'
  })
}
